fix notification of QDockWidget when it gets undocked
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 27 Feb 2020 13:52:19 +0000 (13:52 +0000)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 27 Feb 2020 13:52:19 +0000 (13:52 +0000)
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=06b8644953fc5267
Last-Update: 2019-06-14

Before the patch the notification was emitted only when the docker
was attached to the panel or changed a position on it.

It looks like the old behavior was documented in a unittest,
so this patch might actually be a "behavior change".

Note: https://mail.kde.org/pipermail/distributions/2019-April/000317.html

Gbp-Pq: Name qdockwidget_undocked_notification.diff

src/widgets/widgets/qdockwidget.cpp
tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp

index 6c871aae2c0ae7fcd86b5b3f88897cf10d662c3e..19fc2d16771efb582130c160a36d30b2824bdf42 100644 (file)
@@ -1171,6 +1171,8 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
             QMainWindowLayout *mwlayout = qt_mainwindow_layout_from_dock(q);
             if (mwlayout)
                 emit q->dockLocationChanged(mwlayout->dockWidgetArea(q));
+        } else {
+            emit q->dockLocationChanged(Qt::NoDockWidgetArea);
         }
     }
 
index 078a3215fd33efc84f147e735756790f5ca09c54..99008c737807e22ae9505c7d668710839d19852b 100644 (file)
@@ -669,7 +669,11 @@ void tst_QDockWidget::dockLocationChanged()
     spy.clear();
 
     dw.setFloating(true);
-    QTest::qWait(100);
+    QTRY_COMPARE(spy.count(), 1);
+    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
+             Qt::NoDockWidgetArea);
+    spy.clear();
+
     dw.setFloating(false);
     QTRY_COMPARE(spy.count(), 1);
     QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),